import { createRouter, createWebHistory } from 'vue-router'
import Login from '../views/Login.vue'
import Register from '../views/Register.vue'
import Home from '../views/Home.vue'
import Heritages from '../views/Heritages.vue'
import News from '../views/News.vue'
import Promotion from '../views/Promotion.vue'
import Activities from '../views/Activities.vue'
import Feedback from '../views/Feedback.vue'
import Announcements from '../views/Announcements.vue'
import Information from '../views/Info.vue'
import VideoDetail from '../views/VideoDetail.vue'
import AdminLayout from '../views/admin/AdminLayout.vue'
import AdminDashboard from '../views/admin/AdminDashboard.vue'
import AdminHome from '../views/admin/AdminHome.vue'
import RegistrationInfo from '../views/admin/RegistrationInfo.vue'
import ActivityInfo from '../views/admin/ActivityInfo.vue'
import HeritageCategory from '../views/admin/HeritageCategory.vue'
import ConstructionInfo from '../views/admin/ConstructionInfo.vue'
import PromotionVideo from '../views/admin/PromotionVideo.vue'
import CommentInfo from '../views/admin/CommentInfo.vue'
import FeedbackInfo from '../views/admin/FeedbackInfo.vue'
import AnnouncementInfo from '../views/admin/Announcement.vue'
import NewsInfo from '../views/admin/NewsInfo.vue'
import UserManagement from '../views/admin/UserManagement.vue'
import Layout from "@/components/Layout.vue";
import HeritageList from "../views/admin/HeritageList.vue";
const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/register',
    name: 'Register',
    component: Register
  },
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: 'home',
        name: 'Home',
        component: Home
      },
      {
        path: 'heritages',
        name: 'Heritages',
        component: Heritages
      },
      {
        path: 'news',
        name: 'News',
        component: News
      },
      {
        path: 'promotion',
        name: 'Promotion',
        component: Promotion
      },
      {
        path: 'activities',
        name: 'Activities',
        component: Activities
      },
      {
        path: 'feedback',
        name: 'Feedback',
        component: Feedback
      },
      {
        path: 'announcements',
        name: 'Announcements',
        component: Announcements
      },
      {
        path: 'info',
        name: 'Information',
        component: Information
      },
      {
        path: 'video-detail/:id',
        name: 'VideoDetail',
        component: VideoDetail
      }
    ]
  },
  // 管理员后台路由
  {
    path: '/admin',
    component: AdminLayout,
    children: [
      {
        path: '',
        name: 'AdminHomeRedirect',
        redirect: 'home'
      },
      {
        path: 'home',
        name: 'AdminHome',
        component: AdminHome
      },
      {
        path: 'dashboard',
        name: 'AdminDashboard',
        component: AdminDashboard
      },
      {
        path: 'registration-info',
        name: 'RegistrationInfo',
        component: RegistrationInfo
      },
      {
        path: 'activity-info',
        name: 'ActivityInfo',
        component: ActivityInfo
      },
      {
        path: 'heritage-category',
        name: 'HeritageCategory',
        component: HeritageCategory
      },
      {
        path: 'construction-info',
        name: 'ConstructionInfo',
        component: ConstructionInfo
      },
      {
        path: 'heritage-list',
        name: 'HeritageList',
        component: HeritageList
      },
      {
        path: 'promotion-video',
        name: 'PromotionVideo',
        component: PromotionVideo
      },
      {
        path: 'comment-info',
        name: 'CommentInfo',
        component: CommentInfo
      },
      {
        path: 'feedback-info',
        name: 'FeedbackInfo',
        component: FeedbackInfo
      },
      {
        path: 'Announcement-info',
        name: 'AnnouncementInfo',
        component: AnnouncementInfo
      },
      {
        path: 'news-info',
        name: 'NewsInfo',
        component: NewsInfo
      },
      {
        path: 'user-management',
        name: 'UserManagement',
        component: UserManagement
      },

    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router
